/*
 * Gradient.h
 *
 *  Created on: 2017��2��20��
 *      Author: fangxia722
 */

#ifndef GRADIENT_H_
#define GRADIENT_H_
#include <Vec.h>
#include <Datas.h>
class Gradient{
public:
	Gradient(){datas=NULL,f=NULL;lamada=0;}
	virtual ~Gradient(){}
	virtual Vec* gradient(const Vec& x){
			return f(x,this->datas,this->lamada);
	}
	virtual Vec* pseudogradient(const Vec& x,const double C){return NULL;}
	void set(Vec* (*ff)(const Vec&,Datas*,double)){f=ff;}
	void setDatas(Datas* ds){datas=ds;}
	void setLamada(double ld){lamada=ld;}
private:
	Vec* (*f)(const Vec& x,Datas* ds,double lamada);
	Datas* datas;
	double lamada;
};




#endif /* GRADIENT_H_ */
